package com.shujia.wyh.day13.homework.pizzademo;

/*
        分析：
            培根披萨：
                属性：名称、大小、价格、培根克数
                行为：展示
            海鲜披萨：
                属性：名称、大小、价格、配料
                行为：展示

         向上提取一个父类：Pizza
         Pizza:
            成员变量：name,size,price
            成员方法：show()


 */
import java.util.Scanner;
public class PizzaTest {
    public static void main(String[] args) {
        //创建键盘录入对象
        Scanner sc = new Scanner(System.in);

        Pizza pizza = null;
        System.out.print("请输入想要制作的披萨(1.培根披萨 2.海鲜披萨)：");
        int choice = sc.nextInt();
        switch (choice){
            case 1:
                System.out.println("请输入培根的克数：");
                int gram = sc.nextInt();
                System.out.print("请输入披萨大小：");
                int size = sc.nextInt();
                System.out.print("请输入披萨价格：");
                int price = sc.nextInt();
                pizza = new BaconPizza();
                pizza.setName("培根披萨");
                pizza.setPrice(price);
                pizza.setSize(size);
                BaconPizza bp = (BaconPizza) pizza;
                bp.setGrammage(gram);
                bp.show();
                break;
            case 2:
                System.out.println("请输入配料信息：");
                String mixed = sc.next();
                System.out.print("请输入披萨大小：");
                int size2 = sc.nextInt();
                System.out.print("请输入披萨价格：");
                int price2 = sc.nextInt();
                pizza = new SeaPizza();
                pizza.setName("海鲜披萨");
                pizza.setPrice(price2);
                pizza.setSize(size2);
                SeaPizza bp2 = (SeaPizza) pizza;
                bp2.setMixed(mixed);
                bp2.show();
                break;
            default:
                System.out.println("您输入的信息有误！");
                break;
        }
    }
}
